from pyglet_render.draw import make_polygon
from ship_envs.core.polygon_model import PolygonModel


def model2geom(model):
    if not model:
        return None
    if isinstance(model, PolygonModel):
        geom = polygon_model2geom(model)
        geom.set_color(*model.color)
        return geom


def polygon_model2geom(model):
    return make_polygon(model.get_gemo_pts())
